package com.topone.permission.sercurity.service;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.stereotype.Component;

import com.topone.permission.utils.ControllerUtils;



/**
 * url被限制拥有某个权限时,用户已认证但是没有权限时会被调用
 * @author XiaZhentao
 * @date 2018年12月1日
 */
@Component("myAccessDeniedHandler")
public class MyAccessDeniedHandler implements AccessDeniedHandler {

        @Override
        public void handle(HttpServletRequest request, HttpServletResponse response,
                           AccessDeniedException exception) throws IOException, ServletException {
        	ControllerUtils.failedRepose(request, response, exception);
        }

		
    }